home *** CD-ROM | disk | FTP | other *** search
- /* Functions for using Gestalt.
-
- 93/12/28 aih - split out of MacLib.c */
-
- #include <GestaltEqu.h>
- #include "GestaltLib.h"
- #include "TrapLib.h"
-
- /* true if gestalt trap is available */
- Boolean GestaltAvailable(void)
- {
- static Boolean initialized, available;
-
- if (! initialized) {
- available = TrapAvailable(_Gestalt);
- initialized = true;
- }
- return(available);
- }
-
- /* return gestalt response, or 0 if error or gestalt not available */
- long GestaltResponse(OSType selector)
- {
- long response = 0;
- long result = 0;
-
- if (GestaltAvailable() && Gestalt(selector, &response) == noErr)
- result = response;
- return(result);
- }
-
- /* test bit in gestalt response; false if error or gestalt not available */
- Boolean GestaltBitTst(OSType selector, short bit)
- {
- return(GestaltResponse(selector) & (1 << bit));
- }
-